package com.newhis.vo;

import com.newhis.enums.ReslutCodeEnum;

/**
 * 业务聚合
 *
 * @version [V2.0]
 * @package com.newhis.vo;
 * @description:[用一句话描述该文件做什么]
 * @author: [zhuben]
 * @date: [2024-07-13 16:46]
 * @copyright: 2024 echovin.com
 */

public class ResultVo {
    private int code = ReslutCodeEnum.SUCCESS.getCode();

    private String msg = ReslutCodeEnum.SUCCESS.getMsg();

    private Object data;

    public ResultVo() {
    }

    public ResultVo(ReslutCodeEnum reslutCodeEnum, String msg) {
        this.code = reslutCodeEnum.getCode();
        this.msg = msg;
    }

    public ResultVo(Object data) {
        this.data = data;
    }

    public ResultVo(int code, Object data) {
        this.code = code;
        this.data = data;
    }

    public static ResultVo error(String message) {
        return new ResultVo(ReslutCodeEnum.FAIL, message);
    }

    public static ResultVo ok() {
        return new ResultVo();
    }
    public static ResultVo ok(Object data) {
        return new ResultVo(data);
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
